#!/bin/python3
#-*- coding: utf-8 -*-
# get_dummiet__.py
# @author 刘秋
# @email lq@aqiu.info
# @description
# @created 2020-05-13T10:50:25.890Z+08:00
# @last-modified 2020-05-13T10:59:30.811Z+08:00
#

import numpy as np
import pandas as pd
from matplotlib import pyplot as plt


df = pd.DataFrame({'key': list('bbacab'), 'datal': range(6)})
print(pd.get_dummies(df["key"]))

data = pd.DataFrame({
    'food': [
        'bacon', 'pulled pork', 'bacon', 'Pastrami', 'corned beef', 'Bacon',
        'pastrami', 'honey ham', 'nova lox'
    ],
    'ounces': [4, 3, 12, 6, 7.5, 8, 3, 5, 6]
})

print(pd.get_dummies(data["food"]))